package com.zust.data.web.rest;

import com.zust.data.dto.JsonResponseDto;
import com.zust.data.serivce.ColumnService;
import com.zust.data.serivce.DataService;
import com.zust.data.serivce.UserService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.inject.Inject;

/**
 * @author senselyan
 * @date 2018/5/14 14:14
 */
@RestController
@RequestMapping("/json")
public class JsonResource {

    @Inject
    private UserService userService;

    @Inject
    private DataService dataService;

    @Inject
    private ColumnService columnService;


    @RequestMapping("/data/{dataId}/info")
    public JsonResponseDto oneData(@PathVariable String dataId) {
        return new JsonResponseDto(0, columnService.listByDataId(dataId));
    }
    @RequestMapping("/data/{dataId}")
    public JsonResponseDto getData(@PathVariable String dataId) {
        return new JsonResponseDto(0, dataService.info(dataId));
    }
}
